package com.bcxj.apidriver.controller;

import com.bcxj.apidriver.service.ApiDriverOrderService;
import com.bcxj.internalcommon.dto.OrderRequest;
import com.bcxj.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: ApiDriverController
 * Package: com.bcxj.apidriver.controller
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/11/23 22:06
 * @Version 1.0
 * @Since 1.0
 */
@RestController
@RequestMapping("/order")
public class ApiDriverOrderController {
    @Autowired
    private ApiDriverOrderService apiDriverOrderService;


    /**
     * 司机去接乘客
     * @param orderRequest
     * @return
     */
    @PostMapping("to-pick-up-passenger")
    public ResponseResult toPickUpPassenger(@RequestBody OrderRequest orderRequest) {
        return apiDriverOrderService.toPickUpPassenger(orderRequest);
    }


    /**
     * 司机到达出发点
     * @param orderRequest
     * @return
     */
    @PostMapping("arrived-departure")
    public ResponseResult arrivedDeparture(@RequestBody OrderRequest orderRequest) {
        return apiDriverOrderService.arrivedDeparture(orderRequest);
    }


    /**
     * 司机接到乘客
     * @param orderRequest
     * @return
     */
    @PostMapping("pick-up-passenger")
    public ResponseResult pickUpPassenger(@RequestBody OrderRequest orderRequest) {
        return apiDriverOrderService.pickUpPassenger(orderRequest);
    }

    /**
     * 乘客到达目的地/乘客下车
     * @param orderRequest
     * @return
     */
    @PostMapping("/order-getoff")
    public ResponseResult orderGetoff(@RequestBody OrderRequest orderRequest) {
        return apiDriverOrderService.orderGetoff(orderRequest);
    }


    /**
     * 乘客取消订单
     * @param orderId
     * @return
     */
    @PostMapping("cancel")
    public ResponseResult cancel(@RequestParam String orderId) {
        return apiDriverOrderService.cancel(orderId);
    }
}
